using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Outpatient.Doman.Smart
{
    /// <summary>
    /// 健康咨询/资讯实体类
    /// </summary>
    [Table("Consultation")]
    public class Consultation
    {
        /// <summary>
        /// 咨询唯一标识 - 主键，自增
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ConsultId { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [Required]
        [StringLength(255)]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 内容(富文本格式)
        /// </summary>
        public string Content { get; set; } = string.Empty;

        /// <summary>
        /// 所属分类ID - 外键
        /// </summary>
        [Required]
        public int CategoryId { get; set; }


        /// <summary>
        /// 关键词列表
        /// </summary>
        public string Keywords { get; set; } = string.Empty;

        /// <summary>
        /// 浏览次数
        /// </summary>
        public int ViewCount { get; set; } = 0;

        /// <summary>
        /// 点赞数
        /// </summary>
        public int LikeCount { get; set; } = 0;

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 状态(如"草稿"、"发布"、"审核中"等)
        /// </summary>
        [StringLength(20)]
        public string Status { get; set; } = "草稿";

        /// <summary>
        /// 是否删除 - 软删除
        /// </summary>
        public bool IsDeleted { get; set; } = false;

        // 导航属性
        [ForeignKey("CategoryId")]
        public virtual ConsultationCategory Category { get; set; } = null!;
  
        public virtual ICollection<ConsultationDetail> ConsultationDetails { get; set; } = new List<ConsultationDetail>();
    }
} 